﻿<!DOCTYPE HTML>
<html>
{include file="public:header_css"}
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 营销管理 <span class="c-gray en">&gt;</span> 增值服务列表
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="r">共有数据：<strong>{$total}</strong> 条</span>
	</div>

	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
			<tr class="text-c">
				<th width="80">ID</th>
				<th width="150">主菜单</th>
				<th width="150">费用</th>
				<th width="150">有效期</th>
				<th width="100">操作</th>
			</tr>
			</thead>
			<tbody>
			{foreach name="all_list.data" item="val" key="key"}
			<tr class="text-c">
				<td>{$val.id}</td>
				<td class="text-c">{$val.primary_menu}</td>
				<td class="text-c">{$val.price}元</td>
				<td class="text-c">{$val.period_validity}天</td>
				<td class="td-manage">

					{if $val.flag==1}
					<span>&nbsp;&nbsp;已购买&nbsp;&nbsp;</span>
					{else /}
					<button class="btn btn-primary radius" type="submit" id="submit" onclick="buy('{$val.id}')">&nbsp;&nbsp;立即购买&nbsp;&nbsp;</button>
					{/if}
				</td>
			</tr>
			{/foreach}
			</tbody>
		</table>
	</div>

	{$page}

</div>

{include file="public:footer_js"}

<script type="text/javascript" src="__STATIC__/admin/lib/layer/2.4/layer.js"></script>

<script type="text/javascript">

	function buy(id) {
	    $.post(
	        '{:url("appreciate_user")}',
			{id:id},
			function (res) {
				if (res.code === 1){
				    layer.msg(res.msg,{icon:6,time:1000});
                    location.href = "{:url('market/index')}";
                } else {
				    layer.msg(res.msg,{icon:6,time:1000});
				}
            }
		)
    }

</script>
</body>
</html>